SOURCES  = machine.cc machine_factory.cc model.cc model_link.cc \
	   ioconnections.cc generic.cc output_base.cc output_const.cc output_cart_ball.cc \
	   trace.cc model_trace_eval.cc time.cc model_builder.cc report.cc

UTSOURCES = unit_test.cc ioconnections_test.cc trace_test.cc model_trace_eval_test.cc \
             machine_test.cc time_test.cc model_test.cc machine_factory_test.cc model_builder_test.cc 
             
HEADERS  = $(SOURCES:.cc=.h)
OBJECTS  = $(SOURCES:.cc=.o)
UTOBJECTS  = $(UTSOURCES:.cc=.o)

INCLUDE  = -I/sw/include/boost-1_33_1 
CXXFLAGS = -pg -g -O3 $(INCLUDE) -Wall

# Linux
#DEFINES  = -DLinux
#LIBS     = -lglut -lGL -lboost_thread

# OS X
LIBS     = -L/sw/lib -lboost_thread $(GLFIX) -Ldata_store -ldatastore -Larenas -larenas -Lpredictors -lpredictors

all: predict unit_tests

predict: predict.cc $(OBJECTS)
	g++ $(DEFINES) $(CXXFLAGS) $(INCLUDE) -L/usr/lib -L/usr/X11R6/lib/ $(OBJECTS) $(LIBS) predict.cc -o $@

unit_tests: $(OBJECTS) $(UTOBJECTS)
	g++ $(DEFINES) $(CXXFLAGS) $(INCLUDE) -L/usr/lib -L/usr/X11R6/lib/ $(OBJECTS) $(UTOBJECTS) $(LIBS) -lgtest -o $@

#.cc.o:
#	g++ $(DEFINES) $(CXXFLAGS) $(INCLUDE) -c $<

clean:
	rm -f predict unit_tests gmon.out *.o

tar:    clean
	cd ..; tar zcvf predict.tgz predict

tags:   
	etags *.cc *.h

# rule for building dependency lists, and writing them to a file
# named ".depend".
depend: .depend $(HEADERS)
	rm -f .depend
	gcc -M $(DEFINES) $(SOURCES) $(INCLUDE) > .depend

# now add a line to include the dependency list.
include .depend

